package com.info.zhiduoduo.repository.mapper.company;

import com.baomidou.mybatisplus.mapper.BaseMapper;
import com.info.zhiduoduo.repository.dto.company.CompanyBalanceDto;
import com.info.zhiduoduo.repository.entity.company.CompanyForeign;
import org.apache.ibatis.annotations.Select;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author cuichenglong
 * @since 2020-08-28
 */
public interface CompanyForeignMapper extends BaseMapper<CompanyForeign> {

    @Select(" SELECT cf.merchant_no, c.compname AS companyName, ca.balance " +
            " FROM zdd_company_foreign cf " +
            " LEFT JOIN zdd_company c ON c.compid = cf.compid " +
            " LEFT JOIN zdd_company_account ca ON ca.compid = cf.compid " +
            " WHERE cf.merchant_no = #{merchantNo} ")
    CompanyBalanceDto queryCompanyBalanceByMerchantNo(String merchantNo);

}
